﻿#region Using Statements

#endregion

namespace DirectZZT.Shared.Scripting
{
    /// <summary>
    /// Defines a means for any script language.
    /// </summary>
    public interface IScript : IDebuggableScript
    {
        /// <summary>
        /// Gets the script language that this script uses.
        /// </summary>
        ScriptLanguage Language { get; }
        /// <summary>
        /// Returns the current script state.
        /// </summary>
        ScriptState State { get; }
        /// <summary>
        /// Gets/sets the actual script.
        /// </summary>
        string[] Script { get; set; }
        /// <summary>
        /// Gets/sets an implementation-specific current instruction pointer, which points to the statement currently being executed.
        /// </summary>
        int CurrentInstruction { get; set; }

        /// <summary>
        /// Processes the "#SEND [OBJECT:]EVENT" instruction.
        /// </summary>
        /// <param name="eventName">The name of the event/label.</param>
        void OnSend(string eventName);
        /// <summary>
        /// Signals the script to stop execution as soon as possible.
        /// </summary>
        void Stop();
        /// <summary>
        /// Called when this script instance is attached to a script host.
        /// </summary>
        /// <param name="scriptHost">The script host that this script is attached to.</param>
        void OnAttach(IScriptHost scriptHost);
        /// <summary>
        /// Called when this script instance is detached/removed from a script host.
        /// </summary>
        /// <param name="scriptHost">The script host that this script is detached from.</param>
        void OnDetach(IScriptHost scriptHost);
        /// <summary>
        /// Initializes the script before it's being updated.
        /// </summary>
        void Initialize();
        /// <summary>
        /// Updates this script.
        /// </summary>
        void Update();
    }
}
